package com.niit.ssm.controller;

import com.niit.ssm.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/jdbcTemplate")
public class StudentJdbcTemplateController {

    @Autowired
    @Qualifier("serviceUseTemplate")
    private StudentService service;


    /**
     * 跳转学生信息列表页面
     * @param model
     * @return
     */
    @RequestMapping("/studentInfoPage")
    public String studentInfoPage(Model model){
        int totalCount = service.queryTotalCount();
        model.addAttribute("totalCount",totalCount);

        return "studentInfo";
    }


    /**
     * 查询表中总数据
     * @return
     */
    @RequestMapping("/queryCount")
    public int queryCount(){
        return service.queryTotalCount();
    }

}
